<?php
include_once dirname(__FILE__)."/constants.php";
include_once dirname(__FILE__)."/webpage.php";
include_once dirname(__FILE__)."/verticalmenu.php";
include_once dirname(__FILE__)."/box.php";

class MainPage extends HTMLTable
{
    function MainPage($title, $rightPart)
    {
        $items = array();
        
        $db = new Database(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE);
        $db->connect();
        $db->query("SELECT * FROM main_menu");
        
        while($row = $db->fetch_array())
        {
            array_push($items, $row["Name"]);
        }
        
        $menu = new VerticalMenu($items);
        
        $cell1 = new HTMLTableCell($menu);
        $cell1->setAttribute("width", "150");
        $cell1->setAttribute("valign", "top");
        
        $cell2 = new HTMLTableCell(new Box($title, $rightPart));
        $cell2->setAttribute("width", "800");
        $cell2->setAttribute("valign", "top");
        
        $row = new HTMLTableRow(array($cell1, $cell2));
        $db->close();
        
        parent::HTMLTable($row, '', '', '', 0, 0);
        //$this->setAttribute("border", 1);
    }
}
?>